<?php

include_once 'common.php';

require('externals/phpquery/phpQuery-onefile.php');

$container->db->query("TRUNCATE TABLE av_bloodlines");
$container->db->query("TRUNCATE TABLE av_bloodlines_abilities");


$html = file_get_contents("http://www.bloodlinechampions.com/bloodlines.php");

$doc = phpQuery::newDocument($html);

phpQuery::selectDocument($doc);


$champions = array();

foreach(pq('div#bloodlines_div_container a') as $a) {

    $champion = new Champion (
            $container,
            array (
                    'relative_href' => pq($a)->attr("href"),
                    'name' => pq($a)->find("img")->attr("alt"),
                    'icon' => pq($a)->find("img")->attr("src"),
                    'tooltip' => pq($a)->find("div")->html()
    ));

    $champion->recupera_abilita();

    $champions[] = $champion;


}

foreach ($champions as $champion) {
    $champion->save();
}


//ho tutti i champion - adesso per ognuno recupero le abilità










